package tech.aistar.wyymusicplayer.mapper;

import io.lettuce.core.dynamic.annotation.Param;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import tech.aistar.wyymusicplayer.pojo.Search;

import java.util.List;

public interface SearchMapper {
    // 根据标题模糊查询歌曲
    @Select("select * from songs where title like CONCAT('%',#{value},'%')")
    List<Search> selectByTitle(String title);

    @Select("SELECT " +
            "song_id AS songId, " +
            "title, " +
            "artist, " +
            "album, " +
            "duration " +
            "FROM music " +
            "WHERE title LIKE #{text} OR artist LIKE #{text}")
    List<Search> searchSongs(@Param("text") String text);
}
